import { _decorator, Component, Node, UIOpacity } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('testScroll')
export class testScroll extends Component {
    @property(Node)
    mContent: Node = null;
    start() {

    }

    update(deltaTime: number) {

    }

    OnEvent(event) {
        //console.log(this.mContent.position.y);
        this.mContent.children.forEach(nd => {
            console.log(nd.name + ":" + (nd.position.y - this.mContent.position.y));
            if (nd.position.y + this.mContent.position.y >= 50 || nd.position.y + this.mContent.position.y <= -150) {
                nd.getComponent(UIOpacity).opacity = 0;
            }else{
                nd.getComponent(UIOpacity).opacity = 255;
            }
        })
    }
}


